unit CommEdit;

{$ALIGN ON}
{$MINENUMSIZE 4}
{$WEAKPACKAGEUNIT}

interface

uses Windows, Messages;

const
  {$EXTERNALSYM ECM_FIRST}
  ECM_FIRST               = $1500;      // Edit control messages

  {$EXTERNALSYM EM_SETCUEBANNER}
  EM_SETCUEBANNER                = ECM_FIRST + 1; // Set the cue banner with the lParm = LPCWSTR
  {$EXTERNALSYM EM_GETCUEBANNER}
  EM_GETCUEBANNER                = ECM_FIRST + 2; // Set the cue banner with the lParm = LPCWSTR

{$EXTERNALSYM Edit_SetCueBannerText}
function Edit_SetCueBannerText(hEdit: HWND; lpcwText: PWideChar): bool;
{$EXTERNALSYM Edit_GetCueBannerText}
function Edit_GetCueBannerText(hEdit: HWND; lpcwText: PWideChar;
  cchText: longint): bool;

type
  _tagEDITBALLOONTIP = packed record
    cbStruct: DWORD;
    pszTitle,
    pszText : PWideChar;
    ttiIcon : integer;
  end;
  EDITBALLOONTIP  = _tagEDITBALLOONTIP;
  TEditBalloonTip = _tagEDITBALLOONTIP;
  PEditBalloonTip = ^TEditBalloonTip;

const
  EM_SHOWBALLOONTIP   = ECM_FIRST + 3; // Show a balloon tip associated to the edit control
  EM_HIDEBALLOONTIP   = ECM_FIRST + 4; // Hide any balloon tip associated with the edit control

function Edit_ShowBalloonTip(hEdit: HWND; pebt: PEditBalloonTip): bool;
function Edit_HideBalloonTip(hEdit: HWND): bool;

implementation


function Edit_SetCueBannerText(hEdit: HWND; lpcwText: PWideChar): bool;
begin
  Result := Bool(SendMessage(hEdit,EM_SETCUEBANNER,0,LPARAM(lpcwText)));
end;

function Edit_GetCueBannerText(hEdit: HWND; lpcwText: PWideChar;
  cchText: longint): bool;
begin
  Result := Bool(SendMessage(hEdit,EM_GETCUEBANNER,WPARAM(lpcwText),
    LPARAM(cchText)));
end;

function Edit_ShowBalloonTip(hEdit: HWND; pebt: PEditBalloonTip): bool;
begin
  Result := Bool(SendMessage(hEdit,EM_SHOWBALLOONTIP,0,LPARAM(pebt)));
end;

function Edit_HideBalloonTip(hEdit: HWND): bool;
begin
  Result := Bool(SendMessage(hEdit,EM_HIDEBALLOONTIP,0,0));
end;

end.